package com.wanbang.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wanbang.entities.Goods;
import com.wanbang.entities.ShoppingCar;
import com.wanbang.service.ShoppingCarService;
@Controller
public class ShoppingCarServiceController {
	@Autowired
	private ShoppingCarService shoppingCarService;
	@ResponseBody
	@RequestMapping(value="selectShoppingCarByUserId",method=RequestMethod.GET)
	public List<ShoppingCar> selectShoppingCarByUserId(Integer userId){
		List<ShoppingCar> shoppingCars = shoppingCarService.selectShoppingCarByUserId(userId);
		return shoppingCars;
	}
	
	@ResponseBody
	@RequestMapping(value="selelctGoodsByGoodsId",method=RequestMethod.GET)
	public Goods selelctGoodsByGoodsId(Integer goodsId) {
		Goods goods = shoppingCarService.selelctGoodsByGoodsId(goodsId);
		return goods;
	}
	@ResponseBody
	@RequestMapping(value="selectShoppingCarSum",method=RequestMethod.GET)
	public Double selectShoppingCarSum(Integer userId) {
		Double sum = shoppingCarService.selectShoppingCarSum(userId);
		return sum;
	}
	

}
